package com.cmc.cloud.cmclink.doc.api.document.rep;

import com.cmc.cloud.cmclink.doc.api.document.req.AttachmentUpdateReqDto;
import com.cmc.cloud.cmclink.doc.api.document.req.BlnoInfoReqDto;
import com.cmc.cloud.cmclink.doc.api.document.req.RequirementsUpdateReqDto;
import com.cmc.cloud.cmclink.doc.api.document.req.si.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;

/**
 * @author 周贤
 * @date 2025/10/21
 */
@Schema(description = "管理后台 - 多so 合并si 创建参数")
@Data
@EqualsAndHashCode()
@AllArgsConstructor
@NoArgsConstructor
@ToString()
@Valid
public class BlnoMultipleSoCreateDto {
    @Schema(description = "参与多so合si 的so信息" ,requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "{BlnoMultipleSoCreateVO.blnoMultipleSoVO.NotNull}")
    @Valid
    private BlnoMultipleSoDto blnoMultipleSoVO ;

    @Schema(description = "提单主信息主表数据")
    @NotNull(message = "提单主信息不可为空")
    private BlnoBaseInfoDto blnoBasInfoVO;

    @Schema(description = "提单航线船期信息")
    @NotEmpty(message = "提单航线船期信息不可为空")
    private List<BlnoVslvoyUpdateReqDto> blnoVslvoys;

    @Schema(description = "提单指定支付方式信息")
    private List<BlnoPaymentUpdateReqDto> blnoPayments;

    @Schema(description = "订舱特殊要求")
    private List<RequirementsUpdateReqDto> reqVOList;

    @Schema(description = "提单附件信息")
    private List<AttachmentUpdateReqDto> attachmentReqVO;

    @Schema(description = "提单收发通信息")
    private List<BlnoScnUpdateReqDto> blnoScns;

    @Schema(description = "提单货物信息")
    private List<BlnoCargoUpdateReqDto> blnoCargos;

    @Schema(description = "提单箱信息")
    private List<BlnoCntrInfo> blnoCntrs;

    @Data
    @Schema(description = "提单箱信息DTO")
    public static class BlnoCntrInfo {

        @Schema(description = "主键", example = "10858")
        private Long id;

        @Schema(description = "提单主信息id", requiredMode = Schema.RequiredMode.REQUIRED, example = "14359")
        private Long blnoId;

        @Schema(description = "箱号", requiredMode = Schema.RequiredMode.REQUIRED)
        @NotBlank(message = "{blnocntr.cntrno.notblank}")
        @Length(max = 12, message = "{blnocntr.cntrno.length}")
        private String cntrNo;

        @Schema(description = "铅封号", requiredMode = Schema.RequiredMode.REQUIRED)
        @NotBlank(message = "{blnocntr.sealno.notblank}")
        @Length(max = 100, message = "{blnocntr.sealno.length}")
        private String sealNo;

        @Schema(description = "箱型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
        @NotBlank(message = "{blnocntr.cntrtype.notblank}")
        @Length(max = 2, message = "{blnocntr.cntrtype.length}")
        private String cntrType;

        @Schema(description = "尺寸", requiredMode = Schema.RequiredMode.REQUIRED)
        @NotBlank(message = "{blnocntr.cntrsize.notblank}")
        @Length(max = 2, message = "{blnocntr.cntrsize.length}")
        private String cntrSize;

        @Schema(description = "箱主代码")
        @NotBlank(message = "{blno.cntrowner.notblank}")
        @Length(max = 5, message = "{blno.cntrowner.length}")
        private String cntrOwner;

        @Schema(description = "箱内货物件数", requiredMode = Schema.RequiredMode.REQUIRED)
        @NotNull(message = "{blnocntr.quantity.notnull}")
        private Integer quantity;

        @Schema(description = "箱内货物毛重", requiredMode = Schema.RequiredMode.REQUIRED)
        @NotNull(message = "{blnocntr.grossweight.notnull}")
        private BigDecimal grossWeight;

        @Schema(description = "箱内货物体积", requiredMode = Schema.RequiredMode.REQUIRED)
        @NotNull(message = "{blnocntr.measurement.notnull}")
        private BigDecimal measurement;

        @Schema(description = "箱皮重", requiredMode = Schema.RequiredMode.REQUIRED)
        @NotNull(message = "{blnocntr.cntrtare.notnull}")
        private BigDecimal cntrTare;

        @Schema(description = "VGM重量")
        private BigDecimal vgmWeight;

        @Schema(description = "VGM称重方式")
        @Length(max = 3, message = "{blnocntr.vgmtypecode.length}")
        private String vgmTypeCode;

        @Schema(description = "VGM称重地点")
        @Length(max = 100, message = "{blnocntr.vgmaddress.length}")
        private String vgmAddress;

        @Schema(description = "VGM称重时间")
        private String vgmTime;

        @Schema(description = "VGM验证签名")
        @Length(max = 100, message = "{blnocntr.vgmsignature.length}")
        private String vgmSignature;

        @Schema(description = "前超")
        private Integer overForward;

        @Schema(description = "后超")
        private Integer overAfter;

        @Schema(description = "左超")
        private Integer overLeft;

        @Schema(description = "右超")
        private Integer overRight;

        @Schema(description = "上超")
        private Integer overHeight;

        @Schema(description = "拼箱标记(同航次 同箱号就算拼)")
        private Boolean lcl;

        @Schema(description = "创建人", requiredMode = Schema.RequiredMode.REQUIRED)
        private String creator;
    }

}
